import Pagination from 'rc-pagination';
import React from 'react';

import { IReactPaginationProps } from 'rc-pagination';

// TODO: 输入框默认值
export default (props: IReactPaginationProps) => {
  const totalPage = (props.total || 0) / (props.pageSize || 10);
  const locale = {
    // Options.jsx
    items_per_page: '条/页',
    jump_to: `共${Math.ceil(totalPage)}页，到第`,
    jump_to_confirm: '确定',
    page: '页',

    // Pagination.jsx
    prev_page: '上一页',
    next_page: '下一页',
    prev_5: '向前 5 页',
    next_5: '向后 5 页',
    prev_3: '向前 3 页',
    next_3: '向后 3 页',
  };
  let showQuickJumper: any = false;
  if (props.showQuickJumper) {
    showQuickJumper = {
      goButton: <button className="button button-outline button-short button-rectangle">确定</button>,
    };
  }
  return <Pagination {...props} locale={locale} showQuickJumper={showQuickJumper} />;
};
